package com.usabb.utils;

import com.usabb.domain.AttachDO;
import com.usabb.enums.AttachImageTypeEnum;

import java.util.List;
import java.util.stream.Collectors;



public final class AttachUtil {

    public static List<AttachDO> filterListType(final List<AttachDO> attachDOS) {
        return attachDOS.stream()
                .filter(it -> AttachImageTypeEnum.isListType(it))
                .collect(Collectors.toList());
    }

    public static List<AttachDO> filterRealType(final List<AttachDO> attachDOS) {
        return attachDOS.stream()
                .filter(it -> AttachImageTypeEnum.isReal(it))
                .collect(Collectors.toList());
    }

    public static List<AttachDO> filterAvatarType(final List<AttachDO> attachDOS) {
        return attachDOS.stream()
                .filter(it -> AttachImageTypeEnum.isAvatar(it))
                .collect(Collectors.toList());
    }

    public static List<AttachDO> filterWechatType(final List<AttachDO> attachDOS) {
        return attachDOS.stream()
                .filter(it -> AttachImageTypeEnum.isWechatQrCode(it))
                .collect(Collectors.toList());
    }

    public static List<String> extractPath(final List<AttachDO> attachDOS) {
        return attachDOS.stream().map(it-> it.getPath()).collect(Collectors.toList());
    }

}
